/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

import { TrackAPI } from '../../../common/trace/hvigor-trace-factory.js';
import { FileSet } from '../../../internal/snapshot/util/file-set.js';
import { TaskInputValue } from '../../../internal/snapshot/util/task-input-value-entry.js';

export class TaskInput {
  private declareInputs: Map<string, TaskInputValue>;
  private declareInputFiles: FileSet;

  constructor(declareInputs: Map<string, TaskInputValue>, declareInputFiles: FileSet) {
    this.declareInputs = declareInputs;
    this.declareInputFiles = declareInputFiles;
  }

  @TrackAPI file(path: string): TaskInput {
    this.declareInputFiles.addEntry(path);
    return this;
  }

  @TrackAPI files(paths: string[]): TaskInput {
    this.declareInputFiles.addEntries(paths);
    return this;
  }

  @TrackAPI property(key: string, value: TaskInputValue): TaskInput {
    this.declareInputs.set(key, value);
    return this;
  }
}

export class TaskOutput {
  private declareOutputFiles: FileSet;
  constructor(declareOutputFiles: FileSet) {
    this.declareOutputFiles = declareOutputFiles;
  }

  @TrackAPI file(path: string): TaskOutput {
    this.declareOutputFiles.addEntry(path);
    return this;
  }

  @TrackAPI files(paths: string[]): TaskOutput {
    this.declareOutputFiles.addEntries(paths);
    return this;
  }
}
